<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>选择从编</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(function(){
			$("td").click(function(){
				$("td").each(function(){
					$(this).removeClass("selected");
				});
				$(this).addClass("selected");
			});

			$("tr").mouseover(function(){
				$(this).children().css("background-color", " #00eeee");
			}).mouseout(function(){
				$(this).children().css("background-color", " #ffffff");
			});
		});
		function getSelectValue() {
			var publisher = $(".selected").parent();
			window.parent.publisher = publisher.children("td").eq(0).html();
            window.parent.prAddress = publisher.children("td").eq(1).html();
			return publisher.children("td").eq(0).html();
		}
        function setupPublisher(){
            var publisher = $(".selected").parent();
            window.parent.publisher = publisher.children("td").eq(0).html();
            window.parent.prAddress = publisher.children("td").eq(1).html();
            window.parent.window.jBox.close();
        }
		function btnInsert() {
			// 正常打开
			top.$.jBox.open("iframe:${ctx}/book/publisher/toEdit?publisher=" + $("#publisher").val(), "新增出版社", 400, 200, {
				buttons: {}, loaded: function () {
					$(".jbox-content", top.document).css("overflow-y", "hidden");
				}, closed: function () {
					$("#publisher").val(window.parent.editbooks);
				}
			});
		}
        function btnclear(){
            $("input[name='publisher']").val("");
            $("#searchForm").submit();
        }
	</script>
	<style>
        tr{ cursor: pointer; } .selected{ background-color: #0D8BBD!important; }
	</style>
</head>
<body>
	<form:form id="searchForm" action="${ctx}/book/publisher/listData" method="post" class="breadcrumb form-search">
		<input id="publisher" name="publisher" value="${publisher}"/>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
        <a href="javascript:void(0)" onclick="btnclear()" class="btn">清空查询条件</a>&nbsp;&nbsp;
		<a href="javascript:void(0)" onclick="btnInsert()" class="btn">新增</a>
	</form:form>
	<table class="table table-striped table-bordered table-condensed">
		<tbody id="booksBody">
		<c:forEach items="${publisherList}" var="info" varStatus="status">
			<tr ondblclick="setupPublisher()">
				<td>${info.prName}</td>
				<td>${info.prAddress}</td>
				<td>${info.prPy}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</body>
</html>